#!/usr/bin/env python
# -*- coding:utf-8 -*-

PATH = 'test.log'

class File:
    # self:哪个对象调用这个方法，self就是谁
    def read(self, path):
        with open(path, mode='r', encoding='utf-8') as f:
            data = f.read()
        return data
    def write(self, path,content):
        with open(path, mode='a',encoding='utf-8') as f:
            f.write(content)

# 实例化了一个File类的对象
obj = File()

obj.xxxx = 'test.log'
obj.read('test.log')
obj.write('test.log', 'alex')